package 每日一题;

/**
 * @author 会玩的洋洋
 * https://leetcode-cn.com/problems/number-of-steps-to-reduce-a-number-to-zero/
 */
public class _1342_将数字变成0的操作次数 {
    public int numberOfSteps(int num) {
        int count = 0;
        while (num != 0) {
            if (num % 2 == 0) {
                num = num >> 1;
            } else {
                --num;
            }
            ++count;
        }
        return count;
    }
}
